package com.example.cms.controller;

import com.example.cms.entity.Consultant;
import com.example.cms.pojo.Mesagge;
import com.example.cms.pojo.QueryPage;
import com.example.cms.service.ConsultantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName ConsultantController
 * @Descriptiom TODO
 * @Author Sunbird
 * @Date 2018/12/20 16:07
 * @Version 1.0
 **/
@RestController
public class ConsultantController {

    @Autowired
    private ConsultantService consultantService;

        @RequestMapping("findPageConsult")
        public Mesagge findPageConsult(Mesagge mesagge , QueryPage queryPage,Consultant consultant){
           List<Consultant> consultants= consultantService.getConAndCou(queryPage,consultant);
            mesagge.setList(consultants);
            return  mesagge;
        }
       @RequestMapping("insertConsult")
        public Mesagge insertConsult(Mesagge mesagge ,Consultant consultant){
            int i= consultantService.addtConsultant(consultant);
            mesagge.setMesCode(i);
            return mesagge;
        }
        @RequestMapping("deletConsult")
        public Mesagge deletConsult(Mesagge mesagge ,Integer Ids){
           int i= consultantService.removeConsultant(Ids);
            mesagge.setMesCode(i);
            return mesagge;
        }
}
